(function(angular) {
	'use strict';
	/**
	 * this service for cls common  filter 
	 */
	angular.module('fs.waf').factory('clsCommonService', clsCommonService)
	//transform day num to day date, include date
	.filter("intToDate", [ '$filter', '$locale', 'clsCommonService', function($filter, $locale, clsCommonService) {
		return function(optionValue, pattern) {
			return $filter('translate')(clsCommonService.handIntToDate(optionValue, pattern));
		};
	} ]);
	
	clsCommonService.$inject = [ '$q', 'loggerFactory', 'commonService', 'ajaxServiceFactory', 'modalService', 'gridService', 'arithService', 'dateService', '$filter' ];
	function clsCommonService($q, loggerFactory, commonService, ajaxServiceFactory, modalService, gridService, arithService, dateService, $filter) {
		

				// transform int to date
		function handIntToDate(optionValue, pattern) {
			var date = null, result = null;
			if (pattern && !isNaN(optionValue)) {
				date = dateService.addDays(pattern, parseInt(optionValue) - 1);
				result = optionValue + "(" + ($filter("dateFormat")(date, "date")) + ")";
				return result;
			} else {
				return optionValue;
			}
		}
		
		return {
			handIntToDate : handIntToDate
		};
	}
})(angular);